<template>
  <div class="page-container">
    <!-- 新增轮播图 -->
    <el-carousel height="300px" type="card" indicator-position="outside" arrow="always" style="margin-left: -30px;">
      <el-carousel-item v-for="(item, index) in carouselImages" :key="index">
        <div class="carousel-content">
          <img :src="item.imageUrl" alt="轮播图" class="carousel-image">
        </div>
      </el-carousel-item>
    </el-carousel>
    
    <div class="grid-wrapper">
      <div class="grid-container">
        <div class="grid-item">
          <div class="title-area">
            <router-link to="/xxgg" style="text-decoration: none; color: white; font-size: 18px;font-weight: bold;">招标预告</router-link>
            <span class="more">更多>></span>
          </div>
          <div class="items">
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 【麻城市中心】麻城经济开发区通泰园小学...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 【麻城市中心】麻城市农村公路管理局招标...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 【麻城市中心】麻城经济开发区通泰园小学...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 【汉川市中心】汉川电厂四期扩建工程电力...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 【红安县中心】红安县2023年度小型水库安...<span class="date">2023-04-13</span></p>
          </div>
        </div>
        <div class="grid-item">
          <div class="title-area">
            <p class="title">招标公告</p>
            <span class="more">更多>></span>
          </div>
          <div class="items">
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 平煤隆基新能源科技有限公司——二期电...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 【2023年第4批电气杂项备件询价采购...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 平煤隆基新能源科技有限公司——二期硅烷...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 云南省中医医院污水运维项目咨询邀请公告<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 平煤隆基新能源科技有限公司——动力厂房...<span class="date">2023-04-13</span></p>
          </div>
        </div>
        <div class="grid-item" style="margin-top: -80px;">
          <div class="title-area">
            <p class="title">中标公告</p>
            <span class="more">更多>></span>
          </div>
          <div class="items">
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 山东省淄博市山东鑫泉医药有限公司线路迁...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 张家界旅游学校关于果盘/果篮的网上...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 长沙市芙蓉区朝阳小学关于其他广告服务的...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 沙沟村特色农畜产品电商综合服务中心建设...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 溆源市工贸中专关于LED头灯的网上超市采...<span class="date">2023-04-13</span></p>
          </div>
        </div>
        <div class="grid-item" style="margin-top: -80px;">
          <div class="title-area">
            <p class="title">企业采购</p>
            <span class="more">更多>></span>
          </div>
          <div class="items">
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 慈利县三合镇国太桥中学关于新鲜水果的...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 兰陵县第七中学七中2023年保安经费成交公告<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> (XJ023041300027)CG-连接器询价<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 岳阳县公安局关于机械硬盘的网上超市采购...<span class="date">2023-04-13</span></p>
            <p><img src="/public/images/主页/u19.png" class="checkbox-img"> 青州市机关事务服务中心车辆保险成交公告<span class="date">2023-04-13</span></p>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      // 轮播图数据
      carouselImages: [
        {
          imageUrl: '/images/swiper1.png',
        },
        {
          imageUrl: '/images/swiper2.png',
        },
        {
          imageUrl: '/images/swiper3.png',
        }
      ]
    }
  }
}
</script>

<style scoped>
.page-container {
  width: 100%;
  height: 100%;
  position: relative;
  top: -50px;
}

.el-carousel {
  max-height: 300px;  /* 使用max-height而非固定height */
  height: auto;       /* 让高度自动调整 */
}
/* 轮播图项目样式 */
.el-carousel__item {
  width: 80%;
  padding: 0;
  margin: 0;
}

/* 图片容器样式 */
.carousel-content {
  position: relative;
  width: 70%;
  height: 100%;
  overflow: hidden;
  left: 0px;
  
}

/* 图片样式 - 关键修改 */

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: contain;  /* 使用contain确保图片完整显示 */
}
/* 原有样式保持不变 */
.grid-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
  margin-top: 20px;
  height: 650px;
}

.grid-container {
  display: grid;
  grid-template-columns: 550px 550px; /* 固定宽度 */
  grid-template-rows: 400px 400px;    /* 固定高度 */
  gap: 30px;
  padding: 15px;
  box-sizing: border-box;
}

.grid-item {
  width: 550px;
  height: 300px;
  background-color: white;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.title-area {
  background-image: url('/public/images/主页/u12.png');
  background-size: cover;
  background-position: center;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
}

.title {
  font-size: 18px;
  font-weight: bold;
  margin: 0;
  color: white;
}

.more {
  font-size: 14px;
  color: rgb(65, 59, 59);
  opacity: 0.9;
}

.items {
  padding: 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto; /* 添加滚动条以防内容溢出 */
}

.items p {
  font-size: 16px;
  color: #333;
  margin: 0;
  padding: 6px 0;
  display: flex;
  align-items: center;
  border-bottom: 1px dashed #eee;
  white-space: nowrap; /* 防止文字换行 */
  overflow: hidden;
  text-overflow: ellipsis; /* 文字过长显示省略号 */
}

.checkbox-img {
  width: 16px;
  height: 20px;
  margin-right: 8px;
  flex-shrink: 0; /* 防止图片被压缩 */
}

.date {
  color: #999;
  font-size: 12px;
  margin-left: auto;
  padding-left: 10px;
  flex-shrink: 0; /* 防止日期被压缩 */
}

.items p:last-child {
  border-bottom: none;
}
</style>